package com.clr.springboot.dao;

import com.clr.springboot.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface UserMapper extends Mapper<User> {
    //登录功能-用户名和密码
    @Select("select * FROM User where name=#{name} and password=#{password}")
    User login(@Param("name") String name,@Param("password") String password);

    //通过注解查询出全部数据
    @Delete("<script>" +
            "DELETE FROM user WHERE id IN " +
            "<foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach>" +
            "</script>")
    void batchDelete(@Param("ids") List<Integer> ids);

}
